local tabei = fk.CreateSkill{
  name = "steam__tabei",
  tags = { Skill.Limited },
}

-- 触发技部分：轮次开始时触发
tabei:addEffect(fk.RoundStart, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self.name) and player:usedSkillTimes(self.name, Player.HistoryGame)==0
  end,
  on_cost = function(self, event, target, player, data)
    local room=player.room
    local cards = room:askToCards(player, {
      min_num = 2,
      max_num = 99,
      include_equip = true,
      skill_name = self.name,
      cancelable = true,
      prompt = "#steam__tabei-ask",
    })
    if #cards >= 2 then
      event:setCostData(self, {cards = cards})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room=player.room
    local cards=event:getCostData(self).cards
    --[[
    room:askToUseVirtualCard(player, {
      name = "savage_assault",
      skill_name = self.name,
      prompt = "#steam__tabei-use",
      subcards = cards,
    })
    --]]
    room:useVirtualCard("savage_assault", cards, player,room:getOtherPlayers(player), self.name)
    for _,p in ipairs(room:getOtherPlayers(player)) do
      room:setPlayerMark(p, "@@steam__tabei_usecards-round", #cards)
      room:handleAddLoseSkills(p, "steam__taibei_viewas&")
      room.logic:getCurrentEvent():findParent(GameEvent.Round):addCleaner(function()
        room:handleAddLoseSkills(p, "-".."steam__taibei_viewas&")
      end)
    end
    

  end,
})

tabei:addEffect("prohibit", {
  is_prohibited = function(self, from, to, card)
    return from and from:getMark("@@steam__tabei_usecards-round")>0 and card.trueName=="slash" and card.skillName~="steam__taibei_viewas&"
  end,
}
)
Fk:loadTranslationTable{
  ["steam__tabei"] = "踏北",
  [":steam__tabei"] = "限定技，轮次开始时，你可将至少两张牌当做【南蛮入侵】使用；本轮内，其他角色仅可以用等量张牌转换的方式使用或打出【杀】。",
  ["#steam__tabei-viewas"] = "踏北：你可以将至少两张牌当做【南蛮入侵】使用",
  ["#steam__tabei-ask"] = "踏北：请选择至少两张牌当做【南蛮入侵】使用",
  ["#steam__tabei-use"] = "踏北：请使用至少两张牌当做【南蛮入侵】使用",
  ["@@steam__tabei_usecards-round"] = "踏北锁",
}

return tabei 